package com.mapper;

import com.pojo.User;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import java.util.List;

public class UserMapperImpl extends SqlSessionDaoSupport implements UserMapper {
    @Override
    public List<User> selectUsers() {
        UserMapper mapper = getSqlSession().getMapper(UserMapper.class);

        mapper.insertUser(new User(4, "王五", "111111"));
        mapper.deleteUser(5);

        return mapper.selectUsers();
    }

    @Override
    public int insertUser(User user) {
        return getSqlSession().getMapper(UserMapper.class).insertUser(user);
    }

    @Override
    public int deleteUser(int id) {
        return getSqlSession().getMapper(UserMapper.class).deleteUser(id);
    }
}
